function [desired_state] = circle5(t, qn)
% CIRCLE trajectory generator for a circle
% qn is just 1, t < 30
% =================== Your code goes here ===================
% You have to set the pos, vel, acc, yaw and yawdot variables

T = 12;
%  quintic trajectory 
if (t>=0) && (t<=T)
    theta = -8.88178419700125e-16*t-3.70074341541719e-17*t^2+0.0363610260832152*t^3-0.00454512826040190*t^4+0.000151504275346730*t^5;
    pos = [5*cos(theta); 5*sin(theta); -3.08148791101958e-33*t-4.62592926927149e-18*t^2+0.0144675925925926*t^3-0.00180844907407407*t^4+6.02816358024691e-05*t^5];
    vel = [-5*sin(theta)*(-8.88178419700125e-16-3.70074341541719e-17*2*t+0.0363610260832152*3*t^2-0.00454512826040190*4*t^3+0.000151504275346730*5*t^4);...
            5*cos(theta)*(-8.88178419700125e-16-3.70074341541719e-17*2*t+0.0363610260832152*3*t^2-0.00454512826040190*4*t^3+0.000151504275346730*5*t^4);...
            -3.08148791101958e-33-4.62592926927149e-18*2*t+0.0144675925925926*3*t^2-0.00180844907407407*4*t^3+6.02816358024691e-05*5*t^4];
    acc = [-5*cos(theta)*(-8.88178419700125e-16-3.70074341541719e-17*2*t+0.0363610260832152*3*t^2-0.00454512826040190*4*t^3+0.000151504275346730*5*t^4)-5*sin(theta)*(-3.70074341541719e-17*2+0.0363610260832152*6*t-0.00454512826040190*12*t^2+0.000151504275346730*20*t^3);...
           -5*sin(theta)*(-8.88178419700125e-16-3.70074341541719e-17*2*t+0.0363610260832152*3*t^2-0.00454512826040190*4*t^3+0.000151504275346730*5*t^4)+5*cos(theta)*(-3.70074341541719e-17*2+0.0363610260832152*6*t-0.00454512826040190*12*t^2+0.000151504275346730*20*t^3);...
           -4.62592926927149e-18*2+0.0144675925925926*6*t-0.00180844907407407*12*t^2+6.02816358024691e-05*20*t^3];
else
     pos = [5; 0; 2.5];
     vel = [0; 0; 0];
     acc = [0; 0; 0];
end

%leave as 0
yaw = 0;
yawdot = 0;

% =================== Your code ends here ===================

desired_state.pos = pos(:);
desired_state.vel = vel(:);
desired_state.acc = acc(:);
desired_state.yaw = yaw;
desired_state.yawdot = yawdot;

end

